<script type="text/javascript">
$(function(){
	$("#country").change(function(){
		$("#region").empty();
		<?php foreach ($this->region as $item) {?>
		if("<?php echo $item->countryId?>"==$(this).val() || $(this).val()=='0')
		{
			tmp=$("<option>");
			tmp.val(<?php echo $item->id?>);
			tmp.html("<?php echo $item->name_en ?>");
			$("#region").append(tmp);
		}
		<?php }?>
		if($("#region option").length > 0)
		{
			$("#region").prepend("<option value='0'>All</option>");
		}
	});
	$("#region").change(function(){
		$("#city").empty();
		<?php foreach ($this->city as $item){?>
		if("<?php echo $item->regionId?>"==$(this).val() || $(this).val()=='0')
		{
			tmp=$("<option>");
			tmp.val(<?php echo $item->id?>);
			tmp.html("<?php echo $item->name_en ?>");
			$("#city").append(tmp);
		}
		<?php }?>
		if($('#city option').length > 0)
		{
			$("#city").prepend("<option value='0'>All</option>");
		}
	});
})
</script>
<?php echo $this->search?>
<a class="button" href="<?php echo $this->url(array('controller'=>'hotel','action'=>'addhotel')); ?>">Add new hotel</a><br>
<table class="table">
<thead>
<tr>
<td>Name</td>
<td>Address</td>
<td>City</td>
<td>Priority</td>
<td>Rate</td>
<td></td>
<td></td>
</tr>
</thead>
<?php if(isset($this->hotel)){?>
<tbody>
<?php foreach($this->hotel as $item){?>
<tr>
<td><?php echo $item['name']?></td>
<td><?php echo $item['address']?></td>
<td><?php echo $item['cityId']?></td>
<td><?php echo $item['priority']?></td>
<td><?php echo $item['rate']?></td>
<td><a href="/admin/hotel/edithotel/id/<?php echo $item["id"]?>" class="button">Edit</a></td>
<td><a href="/admin/hotel/delhotel/id/<?php echo $item["id"]?>" class="button">Delete</a></td>
</tr>
<?php }?>
</tbody>
<?php
 }?>
</table>